load TagBlock,ResetTabs,AttachData

! -------------- Start Template -----------------

GoSub ResetTabs,0

! --------- Name -----------
#oldWidth=#rightMargin$
DisplayWidth #oldWidth+#rightSkip+1
newline -#topMargin$-1
hskip -#leftSkip-1
cell GroupBox
  border line
  titleposition none
  cellbackground "Record Header Box Background"
  width -1

  newline -3

  Show NAME
EndGroup

DisplayWidth #oldWidth

! --------- Address -----------
ClearTabs
gosub ResetTabs,50
newline
cell GroupBox,local("Repository Address")
  width -1
  newline -#lineSkip-3
  Show ADDR
  ShowAll PHON

  ! link to web site
  #hasURL="no"
  if WWW is here
    #hasURL="yes"
  else if _URL is here
    #hasURL="yes"
  endif
  if #hasURL="yes"
    newline
    cell static,local("Web Pages")&":"
    sizetofit
    set tabwidth -1 alignment right
    
    hskip 0
    #leftSkip=#hpos$
    ShowAll WWW "here"
    ShowAll _URL "here"
    #leftSkip=#leftSkip$
  endif

  ShowAll EMAIL
  ShowAll _EMAIL
  ShowAll FAX
  ShowAll _GPS
  
  newline
  tab 1
  hskip #cellSkip
  cell LinkButton
  set text local("Linked Sources") border shadowlesssquare
  sizetofit -12
  menulink "Referenced By"

EndGroup
Gosub ResetTabs,0

! --------- NOTEs -----------
Gosub TagBlock,"NOTE","Notes"

! --------- Attach links
newline
cell GroupBox,local("Attach")
  width -1
  newline -#lineSkip-3
  #lineSkip=0
  Show NOTE
  gosub AttachData
EndGroup
#lineSkip=#lineSkip$


! -------- Additional Data ------------
if more is true
  ClearTabs
  gosub ResetTabs,50
  cell GroupBox,local("Additional Data")
    width -1
    ShowAll CHAN
    ShowAll all
  EndGroup
endif

optionalTag RIN,local(RIN)
optionalTag REFN,local(REFN)
optionalTag REFN,local("Keyword(s)"),"","TYPE Keyword(s)"

optionaltag PHON,local("PHON"),""
optionaltag _GPS,local("_GPS"),""
optionaltag EMAIL,local("EMAIL"),""
optionaltag FAX,local("FAX"),""
optionaltag WWW,local("WWW"),""



